package com.wang.common.exception;

import com.wang.entity.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理
 * @author 王福鑫
 * @date 2023/1/21 19 51
 * discription
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = RuntimeException.class)
    public R handle(RuntimeException e){
        log.error("运行时异常:---------{}"+e.getMessage());
        return R.error(e.getMessage());
    }
}
